﻿using FluentNHibernate.Mapping;
using IapService.Entity;

namespace IapService.Mappings
{
    public class SampleMap : ClassMap<Sample>
    {
        public SampleMap()
        {
            Not.LazyLoad();

            Id(x => x.Id);
            Map(x => x.Name);
            Map(x => x.Title);
            References(x => x.Vector, "vectorId").Cascade.Delete().NotFound.Ignore();

            HasMany(x => x.SampleFillers)
                .Inverse()
                .Not.LazyLoad()
                .KeyColumn("sampleId")
                .AsBag()
                ;
        }
    }
}